package com.kly.test.function.like.adapter

import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
import com.kly.test.base.adpater.AdapterCallback
import com.kly.test.databinding.ItemLikeListBinding
import com.kly.test.model.HomeListDataBean
import com.kly.test.util.ImageCached.thumbnail
import com.kly.test.util.Injections.screenWidthD2
import com.kly.test.util.Injections.transformRounded10
import com.kly.test.util.load

class LikeDataListViewHolder(
    parent: ViewGroup,
    callback: AdapterCallback,
    private val binding: ItemLikeListBinding = ItemLikeListBinding.inflate(
        LayoutInflater.from(parent.context),
        parent,
        false,
    )
) : RecyclerView.ViewHolder(binding.root) {

    @RequiresApi(Build.VERSION_CODES.S)
    fun bind(item: HomeListDataBean, position: Int) {

        binding.imgItemLikeCover.load(thumbnail(item.head, width = screenWidthD2, quality = 75), placeHolder = null,
            errorHolder = null, transformRounded10)
    }

}